'MAKEDIRS.BAS - Makes EBBS-PC sub directories.
'Written by Ed Parry
'Started: 911012
'Updated: 920522

'INIT
DIM PATH$(10)

DEFINT A-Z

ON ERROR GOTO ERRHANDLER
OPEN "CONS:" FOR OUTPUT AS #9

r$=CHR$(13)+CHR$(10)
s$=CHR$(32)
esc$=CHR$(27)

PRINT #9, esc$"[1;37;44m"esc$"[2J";

START: 'GET CONFIG PATHS DATA
OOPS=0
OPEN "EBBSCFG.DAT" FOR INPUT AS #2
IF OOPS THEN PRINT #9,R$+"EBBSCFG.DAT FILE NOT FOUND.":BEEP:END
 INPUT #2, A$,A$ 'THROW AWAYS
 FOR I=1 TO 5
  INPUT #2,PATH$(I)
 NEXT
CLOSE #2

'STRIP LEADING AND TRAILING SPACES
FOR I=1 TO 5
 A=INSTR(PATH$(I),"=")
 PATH$(I)=MID$(PATH$(I),A+1)
 PATH$(I)=LTRIM$(RTRIM$(PATH$(I)))
NEXT

'SETUP AND GO!
PRINT #9, "MAKEDIRS.EXE - WRITTEN BY ED PARRY - 05-22-1993"R$
PRINT #9, "THIS PROGRAM QUICKLY CREATES YOUR EBBS-PC v1.5x SUB-DIRECTORIES."R$
PATH$(6)=PATH$(1)+"\DOORS"
PRINT #9, "CURRENT PATHS TO CREATE:"R$

PATH$(6)=PATH$(1)+"\DOORS"
FOR I=1 TO 6
 PRINT#9,PATH$(I)
NEXT

PRINT #9,R$"CONFIRM - CREATE EBBS SUB DIRECTORIES (Y/N)? ";
DO
 A$=INKEY$
LOOP WHILE LEN(A$)=0

IF A$<>"Y" AND A$<>"y" THEN PRINT #9,"NO":GOTO FINISH

PRINT #9, "YES"
PRINT #9,R$R$"CREATING THESE FIRST LEVEL SUB DIRECTORIES:"R$
A$="EXISTS. "
B$="CREATED."


FOR I=1 TO 6
 PRINT #9,PATH$(I)" - ";
 OOPS=0
 MKDIR PATH$(I)
 IF OOPS THEN PRINT#9, A$ ELSE PRINT #9, B$
NEXT

PRINT #9,R$"CREATING THESE SECOND LEVEL SUB DIRECTORIES:"R$
'CREATE MSG SUB DIRECTORIES
PRINT #9,"CREATING MESSAGE BASE SUB DIRECTORIES:"R$
FOR I=1 TO 26
 MPATH$=PATH$(3)+"\MB"+CHR$(i+64)
 PRINT #9,MPATH$" - ";
 OOPS=0
 MKDIR MPATH$
 IF OOPS THEN PRINT#9, A$ ELSE PRINT #9, B$
NEXT

'CREATE XFER SUB DIRECTORIES
PRINT #9,R$"CREATING FILE TRANSFER SUB DIRECTORIES:"R$
FOR I=1 to 26
 MPATH$=PATH$(5)+"\XF"+CHR$(I+64)
 PRINT #9,MPATH$" - ";
 OOPS=0
 MKDIR MPATH$
 IF OOPS THEN PRINT#9, A$ ELSE PRINT #9, B$
NEXT

PRINT #9,R$"EBBS-PC SUB DIRECTORY CREATION COMPLETE."

FINISH:
PRINT #9,R$"PRESS ANY KEY TO RETURN TO DOS."
DO
 A$=INKEY$
LOOP WHILE LEN(A$)=0
CLS
CLEAR
END

ERRHANDLER: 'WATCH FOR FILE NOT FOUND
 OOPS=ERR
RESUME NEXT
